package com.graduate.bssp.controller;

import com.graduate.bssp.entity.Type;
import com.graduate.bssp.service.ITypeService;
import com.graduate.common.constants.MessageConstants;
import com.graduate.common.dto.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.graduate.base.controller.BaseController;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 * 影视分类表 前端控制器
 * </p>
 *
 * @author yongqiangyao
 * @since 2018-02-05
 */
@Controller
@RequestMapping("/bssp/type")
public class TypeController extends BaseController {
    @Autowired
    ITypeService typeService;

    @RequestMapping("/list")
    @ResponseBody
    public AjaxResult typeList(){
        AjaxResult ajaxResult=null;
        try {
            List<Type> typeList = typeService.selectTypeList();
            ajaxResult = json(MessageConstants.BSSP_STATUS_SUCCESS, typeList);
        }
        catch (Exception e){
            e.printStackTrace();
        }
        return ajaxResult;
    }
}
